package com.ttflutter.tkvideodownloader.api

import android.app.Application
import androidx.lifecycle.AndroidViewModel
import androidx.paging.Config
import androidx.paging.toLiveData
import com.ttflutter.tkvideodownloader.AppApplication

/**
 * @author Afra55
 * @date 2020/5/23
 * A smile is the best business card.
 */

class MyViewModel(app: Application) : AndroidViewModel(app) {
    val dao = AppApplication.dao
    val allRepostLiveData = dao.pageAllMedia().toLiveData(
        Config(pageSize = 50, enablePlaceholders = true, maxSize = 300)
    )
    val allSavedRepostLiveData = dao.pageAllSavedMedia().toLiveData(
        Config(pageSize = 50, enablePlaceholders = true, maxSize = 300)
    )
    val allMusicSavedRepostLiveData = dao.pageAllMusicSavedMedia().toLiveData(
        Config(pageSize = 50, enablePlaceholders = true, maxSize = 300)
    )
    val allVideoSavedRepostLiveData = dao.pageAllVideoSavedMedia().toLiveData(
        Config(pageSize = 50, enablePlaceholders = true, maxSize = 300)
    )
}